/*
 * Copyright (c) 2021, mrwang. All rights reserved.
 */

package com.wuyan.gateway;

import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.cloud.gateway.filter.GlobalFilter;
import org.springframework.core.Ordered;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;

/**
 * @author dong
 * @version V1.0
 * @file com.wuyan.auth.CustomGlobalFilter
 * @description
 * @date 2021-03-05
 * @update [序号][日期YYYY-MM-DD] [更改人姓名][变更描述]
 */

public class CustomGlobalFilter implements GlobalFilter, Ordered {
	@Override
	public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
		System.out.println(exchange.getRequest().getPath());
		ServerHttpRequest request = exchange.getRequest();
		request.getHeaders();
		return chain.filter(exchange);
	}

	@Override
	public int getOrder() {
		return Ordered.HIGHEST_PRECEDENCE;
	}
}
